package com.consumer;

import java.util.Random;

/**
 * 售出电脑
 * @author Administrator
 *
 */
public class SaleComputer implements Runnable
{
	
	
	private Buffer buffer;
	
	
	public SaleComputer(Buffer buffer){
		this.buffer = buffer;
	}
	
	@Override
	public void run()
	{
		for(int i = 0 ;i<=500;i++){
			//销售电脑
			Computer computer = buffer.sale();
			System.out.println("消费 "+computer);
			
			try
			{
				Thread.sleep(new Random().nextInt(10)*100);
			} catch (InterruptedException e)
			{
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
